package com.ruoyi.comment.service.impl;

import java.util.Date;
import java.util.List;

import com.ruoyi.comment.domain.PostPlayComment;
import com.ruoyi.comment.mapper.PostPlayCommentMapper;
import com.ruoyi.comment.service.IPostPlayCommentService;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 评论Service业务层处理
 *
 * @author ruoyi
 * @date 2025-05-21
 */
@Service
public class PostPlayCommentServiceImpl implements IPostPlayCommentService {
    @Autowired
    private PostPlayCommentMapper postPlayCommentMapper;

    /**
     * 查询评论
     *
     * @param id 评论主键
     * @return 评论
     */
    @Override
    public PostPlayComment selectPostPlayCommentById(Long id) {
        return postPlayCommentMapper.selectPostPlayCommentById(id);
    }

    /**
     * 查询评论列表
     *
     * @param postPlayComment 评论
     * @return 评论
     */
    @Override
    public List<PostPlayComment> selectPostPlayCommentList(PostPlayComment postPlayComment) {
        return postPlayCommentMapper.selectPostPlayCommentList(postPlayComment);
    }

    /**
     * 新增评论
     *
     * @param postPlayComment 评论
     * @return 结果
     */
    @Override
    public int insertPostPlayComment(PostPlayComment postPlayComment) {
        postPlayComment.setCommentTime(new Date());
        postPlayComment.setUserId(SecurityUtils.getLoginUser().getUserId());
        return postPlayCommentMapper.insertPostPlayComment(postPlayComment);
    }

    /**
     * 修改评论
     *
     * @param postPlayComment 评论
     * @return 结果
     */
    @Override
    public int updatePostPlayComment(PostPlayComment postPlayComment) {
        return postPlayCommentMapper.updatePostPlayComment(postPlayComment);
    }

    /**
     * 批量删除评论
     *
     * @param ids 需要删除的评论主键
     * @return 结果
     */
    @Override
    public int deletePostPlayCommentByIds(Long[] ids) {
        return postPlayCommentMapper.deletePostPlayCommentByIds(ids);
    }

    /**
     * 删除评论信息
     *
     * @param id 评论主键
     * @return 结果
     */
    @Override
    public int deletePostPlayCommentById(Long id) {
        return postPlayCommentMapper.deletePostPlayCommentById(id);
    }
}
